import request from '@/utils/request'

// 查询属性分组列表
export function listGroup(query) {
  return request({
    url: '/mall/attrGroup/list',
    method: 'get',
    params: query
  })
}

//按照分类id获取商品属性列表
export function getListByCatelogId(catalogId) {
  return request({
    url: '/mall/attrGroup/getListByCatelogId/' + catalogId,
    method: 'get'
  })
}

//按照分类id获取分组和属性  attrType 1规格参数 2销售属性
export function getAttrGroupWithAttrByCatelogId(catalogId) {
  return request({
    url: '/mall/attrGroup/getAttrGroupWithAttrByCatelogId/' + catalogId,
    method: 'get'
  })
}

// 查询属性分组详细
export function getGroup(attrGroupId) {
  return request({
    url: '/mall/attrGroup/' + attrGroupId,
    method: 'get'
  })
}

// 新增属性分组
export function addGroup(data) {
  return request({
    url: '/mall/attrGroup',
    method: 'post',
    data: data
  })
}

// 修改属性分组
export function updateGroup(data) {
  return request({
    url: '/mall/attrGroup',
    method: 'put',
    data: data
  })
}

// 删除属性分组
export function delGroup(attrGroupId) {
  return request({
    url: '/mall/attrGroup/' + attrGroupId,
    method: 'delete'
  })
}

// 导出属性分组
export function exportGroup(query) {
  return request({
    url: '/mall/attrGroup/export',
    method: 'get',
    params: query
  })
}
